from django.db import models


# 年级表
class Grade(models.Model):
    name = models.CharField(max_length=20)

    class Meta:
        db_table = "grade"


# 课程表
class Classes(models.Model):
    name = models.CharField(max_length=20)
    grade = models.ForeignKey(Grade, on_delete=models.CASCADE)

    class Meta:
        db_table = "classes"


# 用户表
class User(models.Model):
    username = models.CharField(max_length=20)
    card = models.CharField(max_length=30)
    password = models.CharField(max_length=20)
    grade = models.ForeignKey(Grade, on_delete=models.CASCADE)

    class Meta:
        db_table = "user"
